/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-03-30
 * Time: 18:59
 */
public class Demo1 {
    public static void main(String[] args) throws InterruptedException {
     Thread t=new Thread(()->{
         while(!Thread.currentThread().isInterrupted()){
             System.out.println("hello thread");
             try {
                 Thread.sleep(1000);
             } catch (InterruptedException e) {
                 break;
             }
         }
     });
     t.start();
     Thread.sleep(1000);
     t.interrupt();

    }
}
